package javaCode.chapter13.list;

import java.util.*;

/**
 * @author 徐州城
 * @version 1.0
 */
public class ListFor {
    @SuppressWarnings("all")
    public static void main(String[] args) {

        //List 接口的实现子类 Vector LinkedList
        //List list = new ArrayList();
        List list = new LinkedList();
        //List list = new ArrayList();
        list.add("张三");
        list.add("李四");

        System.out.println("==迭代器==");
        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            System.out.println("obj=" + obj);
        }

        System.out.println("==增强for==");
        for (Object obj :list) {
            System.out.println("obj=" + obj);
        }

        System.out.println("==for==");
        for (int i = 0; i < list.size(); i++) {
            System.out.println("obj=" + list.get(i));
        }
    }
}
